//
// Created by devink on 8/27/17.
//

#include "eventloop.h"
#include "util/log.h"
#include "link.h"
#include "channel.h"
#include "poller.h"

using namespace dong;
Eventloop::Eventloop() {
    poller_ = createPoller();
}

void Eventloop::loop() {
    while (1)
    {
        if(poller_->loop_once(1000* 6) < 0)
        {
            break;
        }
    }
}
void Eventloop::addChannel(Channel *ch) {
    poller_->addChannel(ch);
}
void Eventloop::removeChannel(Channel *ch) {
    poller_->removeChannel(ch);
}
void Eventloop::updateInPoller(Channel *ch) {
    poller_->updateChannel(ch);
}
